package org.example.work1.account.controller;

import org.example.work1.account.entity.Account;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.example.work1.account.rocketmq.AccountProduceService;

/**
 * 帐户控制器
 *
 * @author xh
 * @date 2023/03/08
 */
@RestController
@Slf4j
@RequestMapping(value = "/v1")
public class AccountController {
    @Autowired
    AccountProduceService accountProduceService;
    @PostMapping(value = "/account")
    public void addAccount() {

        Account account = new Account();
        account.setId(1L);
        account.setName("testAccount");
        account.setMoney(1000L);
        accountProduceService.produceAccount(account);
    }

    @PutMapping(value = "/account")
    public void updateAccount() {

        Account account = new Account();
        account.setId(2L);
        account.setName("testAccount");
        account.setMoney(1000L);
        accountProduceService.produceAccount(account);
    }
}
